<admintpl file="header" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/js/ueditor/third-party/video-js/video-js.min.css"/>
<script type="text/javascript" src="__PUBLIC__/js/ueditor/third-party/video-js/video.js"></script>
<script src="http://cdn.bootcss.com/html5media/1.1.8/html5media.min.js"></script>
<script src="http://api.html5media.info/1.1.4/html5media.min.js"></script>

</head>
<body>

<div class="wrap">
	<form method="POST" class="form-horizontal" id="pub_form" action="" enctype="multipart/form-data">
		<div class="html" style="width:703px;border-bottom: 3px solid #dce4ec;margin-bottom: 20px;">
			<div class="control-group">
				<label class="span1 control-label" style="width: 90px;text-align: right;">选择组：</label>
				<div class="zu_span3">
					<select name="group_id" class="select_group" id="0">
						<foreach name="all_group" item="vo">
							<option name="g_id" <?php if($info['group_id'] == $vo['class_id']){echo 'selected="selected"';}?> value="{$vo.class_id}">
								{$vo.class_name}</option>
						</foreach>
					</select>
				</div>
			</div>

			<div class="control-group">
				<label class="span1 control-label" style="width: 90px;text-align: right;">选择类：</label>
				<div class="zu_span3">
					<select class="class_option0" name="class_id">
						<foreach name="all_class" item="vo">
							<option name="g_id" <?php if($info['class_id'] == $vo['class_id']){echo 'selected="selected"';}?> value="{$vo.class_id}">
								{$vo.class_name}</option>
						</foreach>
					</select>
				</div>
			</div>

			<div class="control-group">
				<label class="span2 control-label" style="width: 90px;">名称：</label>
				<div class="span7">
					<input type="text" name="name" style="width: 556px;" value="{$info.name}">
				</div>
			</div>


			<div class="control-group">
				<label class="span1 control-label" style="width: 90px;">图片：</label>
				<div class="span4 wrapper">
					<div id="uploader-image">
						<div id="fileList" class="uploader-list">
							<div id="imageDiv" class="file-item thumbnail" style="width:150px;height: 150px;">
								<?php
											if(!empty($info['cover_image'])){
										?>
								<img id="imagePreview" src="{$info.cover_image}" style="width:150px;height: 140px;">
								<?php
											}else{
											?>
								<img id="imagePreview" src="__PUBLIC__/images/furley_bg.png" style="width:150px;height: 140px;">
								<?php
											}
											?>
								<div onclick="select_img('imageFile')" class="picker info">选择图片&nbsp;&nbsp;&nbsp;&nbsp;</div>
								<input style="display:none;" type="file" id="imageFile" class="upload_file" onchange="changeImage(this.id,'imagePreview');" name="imageFile[]">
							</div>
						</div>
					</div>
				</div><div style="color:red;float:left;margin-top:140px">*尺寸：240*290  格式：JPG/PNG</div>
			</div>

			<div class="control-group">
				<label class="span2 control-label" style="width: 90px;">简介：</label>
				<?php if($info['abstract']){ ?>
					<div class="span7" id="html4">
						<?php foreach($info['abstract'] as $k=>$v){ ?>
							<input type="text" style="width: 556px; height: 20px; margin-top: 10px;" value="{$v}" name="abstract[]">
						<?php } ?>
					</div>
				<?php }else{ ?>
					<div class="span7" id="html4">
						<input type="text" style="width: 556px; height: 20px;" value="" name="abstract[]">
					</div>
				<?php } ?>
				<a style="font-size: 20px; display: block; float: left;margin-left: 360px" onclick="copyHtml4()">添加+</a>
			</div>
		</div>


		<input type="hidden" name="id" value="{$_GET['id']}">
		<input type="hidden" name="img_url" value="{$info.cover_image}">
		<div class="form-actions" style="padding-left:0px;padding-right:0px;clear: both;text-align: center;width:700px;">
			<button type="button" id="quick_publish" class="btn" data-save="1">保存</button>
		</div>
</form>
</div>
<input type="hidden" value="0" name="pictureMax" id="pictureMax">
<script src="__PUBLIC__/js/common.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/content_addtop.js"></script>
<script type="text/javascript">
    //编辑器路径定义
    var editorURL = GV.DIMAUB;
</script>
<script type="text/javascript" src="__PUBLIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/ueditor/ueditor.all.min.js"></script>

<script type="text/javascript" >
    $(function() {

    });
    function copyHtml4() {
        var str = '<input type="text" style="width: 556px; height: 20px; margin-top: 10px;" value="" name="abstract[]">';
        $('#html4').append(str)
    }


    function insertHtml() {
        var value = prompt('插入html代码', '');
        var s = value.indexOf(".mp4") ;
        var img_video = $("#img_video").val();
        if(s == -1){ //不是 mp4格式的
            value = value;
        }else{
            value = '<video src="'+value+'" style="width:100%" controls="controls" autoplay="autoplay" poster="'+img_video+'" class="videoplay"><\/video>';
        }
        UE.getEditor('content').execCommand('insertHtml', value)
    }

    function html5Reader(file, previewId){
        var file = file.files[0];
        var reader = new FileReader();
        reader.readAsDataURL(file);
        reader.onload = function(e){
            $('#'+previewId).attr('src', this.result);
        }
    }

    function image_change(fileId, previewId) {
        var pic = document.getElementById(previewId),
            file = document.getElementById(fileId);
        var ext = file.value.substring(file.value.lastIndexOf(".")+1).toLowerCase();

        // gif在IE浏览器暂时无法显示
        if(ext != 'png' && ext != 'jpg' && ext != 'jpeg'){
            alert("图片的格式必须为png或者jpg或者jpeg格式！");
            return;
        }
        var isIE = navigator.userAgent.match(/MSIE/)!= null,
            isIE6 = navigator.userAgent.match(/MSIE 6.0/)!= null;

        if(isIE) {
            file.select();
            var realLocalPath = document.selection.createRange().text;

            // IE6浏览器设置img的src为本地路径可以直接显示图片
            if (isIE6) {
                pic.src = realLocalPath;
            }else {
                // 非IE6版本的IE由于安全问题直接设置img的src无法显示本地图片，但是可以通过滤镜来实现
                pic.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod='image',src=\"" + realLocalPath + "\")";
                // 设置img的src为base64编码的透明图片 取消显示浏览器默认图片
                pic.src = '';
            }
        }else {
            html5Reader(file, previewId);
        }
    }

    function select_img(dom_id){
        $("#"+dom_id).click();
	}

    function changeImage(FileImage1,imageUrl_preview1){
        image_change(FileImage1, imageUrl_preview1);
    }
</script>
</body>
</html>